package cn.fengzhilun.javase.day14.day10;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.Test;

import cn.fengzhilun.javase.day14.day09.Score;

public class TestClass {
	@Test
	public void test1() {
		List<Integer> list = new ArrayList<>();
		
		for(int i =1;i<=10;i++) {
			list.add(i);
		}
		
		while(list.size() > 0) {
		int index = (int )(Math.random()*list.size());
		System.out.println(list.get(index));
		list.remove(index);
		}
	}
	@Test
	public void test2() throws IOException {
	  List<String> lines = Files.readAllLines(Paths.get("data/scores.csv"));
	  
	  Map<String,Integer> map = new HashMap<>();
	  
	  for(String line : lines) {
		  String[] split = line.split(",");
		  
		  for(String word : split) {
			  if(map.containsKey(word)) {
				  map.put(word, map.get(word)+1);
			  }else {
				  map.put(word, 1);
			  }
		  }
	  }
	  System.out.println(map);
	}
}
